window.HeadFactory = new function() {

	this.EMPTY = new function(){
		this.getStatusLine = function(){return null;}
		this.getAllHeaders = function(){return [];}
		this.getHeader = function(nam) {return null;}
	};
	
	this.generateBoundary = function() {
		var ret = "---------------------------";
		for(var i = 0; i < 29; i++)
			ret += ""+Math.floor(Math.random()*10);
		return ret;
	}
	
	this.createHead = function(statusLine, headers) {
		return new Head(statusLine, headers);
	}
	
	this.createHead1 = function(headers) {
		return new Head(null, headers);
	}
	
	this.createHead2 = function(h, headers) {
		var a = new Array();
		var i = 0;
		var all = h.getAllHeaders();
		
		for(var id in headers)
			a[i++] = headers[id];
		for(var id in all)
			a[i++] = all[id];
			
		return this.createHead(h.getStatusLine(), a);
	}

	this.createHead3 = function(h,statusLine,headers) {
		return this.createHead(statusLine, this.createHead2(h, headers).getAllHeaders());
	}	
}